{% extends 'base.html' %}
{% block content %}
<div class="container mt-4">
    <h2>用户管理</h2>
    <div class="mb-3">
        <a href="{% url 'user-create' %}" class="btn btn-primary">添加用户</a>
        <a href="{% url 'user-import-export' %}" class="btn btn-success">导入/导出</a>
    </div>
    
    <table class="table table-striped">
        <thead>
            <tr>
                <th>用户名</th>
                <th>角色</th>
                <th>部门</th>
                <th>电话</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {% for user in users %}
            <tr>
                <td>{{ user.username }}</td>
                <td>{{ user.get_role_display }}</td>
                <td>{{ user.department }}</td>
                <td>{{ user.phone }}</td>
                <td>
                    <a href="{% url 'user-update' user.pk %}" class="btn btn-sm btn-warning">编辑</a>
                    <a href="{% url 'user-delete' user.pk %}" class="btn btn-sm btn-danger">删除</a>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %}